<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/


// Route::get('/', function () {
//     return view('welcome');
// });
Route::get('/home/chanpin','home\ProductAjaxController@index');



Route::get('/', 'home\IndexController@index');
// Route::resource('admin/user','admin\UserController');
// 获取验证码
// 后台登录
Route::get('/capch/{tmp}','admin\LoginController@capch');
Route::get('admin/login','admin\LoginController@index');
Route::post('admin/login','admin\LoginController@dologin');
// 后台组
Route::group(['prefix'=>'admin','middleware' => 'checkUser'],function(){
	// 资讯
	Route::resource('/news','admin\NewsController');
	// 详情
	Route::get('/details/{id}','product\DetailsController@index');
	Route::post('details/update/{id}','product\DetailsController@update');


	Route::post('/details/insert','product\DetailsController@insert');


	// Route::post('/details/insert','product\DetailsController@insert');


	Route::resource('/user','admin\UserController');
	//管理员
	Route::resource('/manager','admin\ManagerController');
	//退出
	Route::get('/logout','admin\LoginController@logout');
	//友情链接
	Route::resource('/links','admin\LinksController');
	//后台首页
	Route::get('/','admin\IndexController@index');
	// 类别
	Route::resource('/type','admin\TypeController');
	// 添加子类别
	Route::get('/typeSon/{id}','admin\TypeController@createSon');
	Route::post('/typeSon','admin\TypeController@storeSon');
	Route::resource('/eval','admin\EvalController');
	// 商品信息表
	Route::resource('/product','product\ProductController');
	//后台订单
	Route::resource('/myorder','admin\MyorderController');
	Route::resource('/nosend','admin\NosendController');
	Route::resource('/noreceive','admin\NoreceiveController');
	Route::resource('/complete','admin\CompleteController');

	Route::resource('/recycle','admin\RecycleController');
	// 特价商品
	Route::resource('/sales','product\SalesController');
	// 热卖商品
	Route::resource('popular','product\PopularController');
	//后台发货的ajax
	Route::get('/aja/doSend','admin\NosendController@doSend');
	
	// 浏览记录
	Route::resource('/log','admin\LogController');
	// 推荐商品
	Route::resource('/recommend','admin\RecommendController');
});
// 前台首页
Route::get('/home','home\IndexController@index');
// 前台登录
Route::get('/home/gologin','home\LoginController@gologin');
Route::post('/home/login','home\LoginController@dologin');

// 商品详情
Route::get('product/details/{id}','home\DetailsController@index');


// 前台组
Route::group(['prefix'=>'home','middleware' => 'checkhomeUser'],function(){

	Route::get('/loginhomeout','home\LoginController@loginhomeout');
	Route::resource('/eval','home\EvalController');
	//前台订单页
	Route::resource('/userorder','home\UserorderController');
	//收藏
	Route::resource('/interest','home\InterestController');
	//前台收藏的ajax
	Route::get('/aja/interest','home\UserorderController@interest');
	Route::get('/aja/dointerest','home\UserorderController@doInterest');
	Route::get('/aja/doEval','home\UserorderController@doEval');
	//前台确认收货
	Route::get('/aja/dookconfirm','home\OkconfirmController@dookconfirm');
 });
//商品搜索
Route::get('/home/search','home\SearchController@index');
//分类搜索
Route::get('/home/search/{id}','home\SearchController@typeindex');
// 商品详情页
Route::resource('home/product','home\ProController');
Route::get('home/index','home\IndexController@index');
Route::get('home/index/{id}','home\IndexController@doindex');
Route::get('home/proajax','home\proajaxController@index');
Route::get('home/quanping', 'home\proajaxController@qp');
Route::get('home/haoping', 'home\proajaxController@hp');
Route::get('home/zhongping', 'home\proajaxController@zp');
Route::get('home/chaping', 'home\proajaxController@cp');
Route::get('home/proajax/{id}','home\proajaxController@shopcar');
//联系客服的ajax
Route::get('home/chat','home\proajaxController@chat');
Route::get('home/get_chat','home\proajaxController@get_chat');

//个人资料
Route::resource('/home/userinfo','home\UserInfoController');
//确认收货
Route::get('/home/okconfirm','home\OkconfirmController@index');
//收货地址
// Route::resource('/home/address','home\AddressController');
Route::resource('/home/address','home\AddressController');
Route::get('/home/aja','home\AjaController@get');
Route::get('/home/aja/get','home\AjaController@doget');
Route::post('/home/aja/post','home\AjaController@dopost');


// 文件上传
Route::get('/upload','upload\UploadController@index');
Route::post('/upload','upload\UploadController@doUpload');
//注册
Route::get('/home/register','home\LoginController@goregister');
Route::post('/home/doregister','home\LoginController@doregister');
//个人资料
Route::get('/home/gouserinfo','home\IndexController@gouserinfo');
Route::resource('/home/userinfo','home\UserInfoController');


//带搜索分页的模板继承
Route::resource('a','admin\UserController');
//购物车的路由群组
Route::group(['prefix'=>'car'],function(){
	Route::get("/sucar","car\CarController@success");
	Route::resource("/shopping",'car\CarController');
	Route::post("/aja",'car\CarController@post');


	Route::resource("/order",'car\OrderController');
	//Route::get("/order/create",'car\OrderController@create');
	Route::get("/order/createaddress/{order_id}",'car\OrderController@createaddress');
	Route::get("/aja/user_id",'car\OrderController@aja_user_id');

	Route::resource("/pay",'car\PayController');
	Route::post("/pay/change",'car\PayController@update');
});
	Route::get('/aja1','OrderController@get');
	Route::get("/aja1/address_get",'car\OrderController@doget');
	Route::post("/aja1/address_post",'car\OrderController@dopost');
	Route::get('admin/chat','car\CarController@chat');
	Route::get('admin/get_chat','car\CarController@get_chat');



